# Binomial Distribution # In an inspection of automobiles in Los Angeles, 60% # had emissions that did not meet EPA regulations. # For a random sample of 10 automobiles, # let X=# vehicles failing inspection # find the following probabilities # a) all 10 vehicles failed the inspection # b) Exactly 6 of the 10 failed the inspection # c) Six or more failed the inspection # d) All 10 passed the inspection # X~bin(n,p)=X~bin(10,0.6) # P(X=x)=(nCr)(p^x)(q^(n-x)) where q=1-p # dbinom(x,n,p) # a) P(X=10) dbinom(10,10,.6) # b) P(X=6) dbinom(6,10,.6) #c) P(X>=6)=P(6)+P(7)+P(8)+P(9)+P(10) sum(dbinom(6:10,10,.6)) #d) P(X=10 "failures") where p= 1-.6 =.4 dbinom(10,10,.4) # OR P(X=0 "successes") where p=.6 dbinom(0,10,.6) # hypergeometric function dhyper(x,M,N-M,n) # Five individuals from an animal population thought to be near # extinction in a certain region have been caught, tagged, and released # to mix into the population. After they have had an opportunity to # mix, a random sample of 10 of these animals is selected. Let X = # the number of tagged animals in the second sample. If there are # actually 25 animals of this type in the region, find the following: M=5 N=25 n=10 # Probability that exactly 2 are tagged? (P(X = 2)) # Probability that exactly 4 are tagged? (P(X = 4)) # Probability that at most 2 are tagged? (P(X <= 2)) # Find EX, VX, SDX # P(X=2) dhyper(2,M,N-M,n) # or dhyper(2,5,25-5,10) # P(X=4) dhyper(4,M,N-M,n) # or dhyper(4,5,25-5,10) # P(X <= 2) sum(dhyper(0:2,M,N-M,n)) # or sum(dhyper(0:2,5,25-5,10)) # EX=n(M/N) VX=n(M/N)(1-M/N)((N-n)/(N-1))=EX*(1-M/N)((N-n)/(N-1)) # bound is the bound on the error of estimation, aka Margin of error EX=n*(M/N); EX VX=EX*(1-M/N)*((N-n)/(N-1)); VX SDX=sqrt(VX); SDX rbind(EX,VX,SDX) # Poisson distribution # Cars arrive at a toll booth on average at a rate of 6 cars per 10 seconds # during rush hours. Let X be the number of cars arriving # during any 10-second period during rush hours. # Find the following probabilities: # a) No cars arrive # b) More than one car arrives # c) At least 2 cars arrive # X~poi(lambda)=X~poi(mu)=X~poi(6) # use dpois(x,lambda) # a) P(X=0) no cars arrive in next 10 seconds dpois(0,6) # b) P(X>1)=1-P(X<=1) 1-sum(dpois(0:1,6)) # c)P(X>=2)=1-P(X<2)=1-P(X<=1) 1-sum(dpois(0:1,6)) # Geometric distribution # An Olympic archer is able to hit the bull's-eye 80% of the time # Assume each shot is independent of one another # Find: # a) probability the first bull's-eye is on the 2nd shot # b) probability the first bull's-eye is on the 3rd or 4th shot # c) would you be surprised if the 1st one came on the 6th shot? # calculate probability the first one is on the 6th shot # d) mean, variance, standard deviation # a) dgeom(2,.8) # b) sum(dgeom(3:4,.8)) # c) dgeom(6,.8) # should be small so very surprised! # d) EX=1/.8; EX VX=.2/(.8^2); VX SDX=sqrt(VX); SDX